package com.sicheng.lc.周赛.分类.栈;

import java.util.Arrays;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/5 21:11
 */
public class 摧毁小行星 {
    //https://leetcode.cn/problems/destroying-asteroids/
    public boolean asteroidsDestroyed(int mass, int[] asteroids) {
        Arrays.sort(asteroids);
        long k = mass;
        for (int asteroid : asteroids) {
            if (k < asteroid)
                return false;
            k += asteroid;
        }
        return true;

    }
}
